package nextoffer.Tencent2;

import java.util.Arrays;
import java.util.Scanner;

public class Third {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n,t;
        n = in.nextInt();
        t = in.nextInt();
        int pos[] = new int[n];
        int speed[] = new int[n];
        int rankPre[] = new int[n];
        int rankAfter[] = new int[n];

        for (int i = 0; i < n; i++) {
            pos[i] = in.nextInt();
            rankPre[i] = n - i;
        }
        for (int i = 0; i < n; i++) {
            speed[i] = in.nextInt();
        }
        int posVis[] = new int[n];
        for (int i = 0; i < n; i++) {
            posVis[i] = pos[i] + t * speed[i];
        }


        int[][] tmp = new int[n][3];
        for (int i = 0; i < n; i++) {
            tmp[i][0] = posVis[i];
            tmp[i][2] = i;
        }
        Arrays.sort(tmp, (a,b) -> b[0] - a[0]);
        int cnt = 1;
        tmp[0][1] = cnt;
        for (int i = 1; i < n; i++) {
            if(tmp[i][1] == tmp[i - 1][1]) //如果排名相同
            tmp[i][1] = cnt;
            else {
                tmp[i][1] = ++cnt;
            }
        }
        Arrays.sort(tmp, (a,b) -> a[2] - b[2]);
        for (int i = 0; i < n; i++) {
            rankAfter[i] = tmp[i][1];
        }

        int res = 0;
        for (int i = 0; i < n; i++) {
            if(rankAfter[i] > rankPre[i]) res++;
        }
        System.out.println(res);

    }
}
